package com.cssy.xxkj.basic.dao.impl;

import com.cssy.xxkj.basic.dao.BasicProductBomProcessDAO;
import com.cssy.xxkj.basic.entity.BasicProductBomProcessDO;
import com.cssy.xxkj.logic.entity.vo.UtilsEntityVO;
import com.plat.helper.SearchConditions;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * 数据访问对象实现类
 * @since 2014-09-19
 */
public class BasicProductBomProcessDAOImpl extends SqlMapClientDaoSupport implements BasicProductBomProcessDAO {

    /**
     * 插入数据
     * @param basicProductBomProcessDO
     * @return 插入数据的主键
     */
    public String insertBasicProductBomProcessDO(BasicProductBomProcessDO basicProductBomProcessDO) {
        Object id = getSqlMapClientTemplate().insert("BasicProductBomProcess.insert", basicProductBomProcessDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param basicProductBomProcessDO
     * @return 查出的记录数
     */
    public Integer countBasicProductBomProcessDOByExample(BasicProductBomProcessDO basicProductBomProcessDO) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("BasicProductBomProcess.countByDOExample", basicProductBomProcessDO);
        return count;
    }

    /**
     * 更新记录
     * @param basicProductBomProcessDO
     * @return 受影响的行数
     */
    public Integer updateBasicProductBomProcessDO(BasicProductBomProcessDO basicProductBomProcessDO) {
        int result = getSqlMapClientTemplate().update("BasicProductBomProcess.update", basicProductBomProcessDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param basicProductBomProcessDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<BasicProductBomProcessDO> findListByExample(BasicProductBomProcessDO basicProductBomProcessDO) {
        List<BasicProductBomProcessDO> list = getSqlMapClientTemplate().queryForList("BasicProductBomProcess.findListByDO", basicProductBomProcessDO);
        return list;
    }

    /**
     * 根据主键获取basicProductBomProcessDO
     * @param id
     * @return basicProductBomProcessDO
     */
    public BasicProductBomProcessDO findBasicProductBomProcessDOByPrimaryKey(String id) {
        BasicProductBomProcessDO basicProductBomProcessDO = (BasicProductBomProcessDO) getSqlMapClientTemplate().queryForObject("BasicProductBomProcess.findByPrimaryKey", id);
        return basicProductBomProcessDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteBasicProductBomProcessDOByPrimaryKey(String id) {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("BasicProductBomProcess.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public Integer deleteBomId(String id) {
		Integer rows = (Integer) getSqlMapClientTemplate().delete("BasicProductBomProcess_ex.deletebomId", id);
        return rows;
	}

	@Override
	public List<UtilsEntityVO> findListByCondition(
			SearchConditions scs) {
		return getSqlMapClientTemplate().queryForList("BasicProductBomProcess_ex.findProcessAll", scs);
	}

}